package com.gamex.findit.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gamex.findit.dao.MemberSkillMapper;
import com.gamex.findit.model.MemberSkill;
import com.gamex.findit.service.MemberSkillService;

/**
 * 회원스킬 서비스
 * @author james
 *
 */
@Service
public class MemberSkillServiceImpl implements MemberSkillService{
	
	private static final Logger logger = LoggerFactory.getLogger(MemberSkillServiceImpl.class);

	@Autowired MemberSkillMapper memberSkillMapper;
	
	@Override
	public List<MemberSkill> getMemberSkill(MemberSkill memberSkill) throws Exception{
		List<MemberSkill> result = null;
		try {
			result = memberSkillMapper.selectMemberSkill(memberSkill);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		return result;
	}

	@Override
	public int getMemberSkillCount(MemberSkill memberSkill) throws Exception{
		int count = 0;
		try {
			count = memberSkillMapper.selectMemberSkillCount(memberSkill);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		return count;
	}

	@Override
	public MemberSkill getMemberSkillView(int SkillId, String userId) throws Exception{
		MemberSkill result = null;
		try {
			result = memberSkillMapper.selectMemberSkillView(SkillId, userId);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		return result;
	}
	
	@Override
	public MemberSkill checkMemberSkill(int SkillId, String userId) throws Exception{
		MemberSkill result = null;
		try {
			result = memberSkillMapper.checkMemberSkill(SkillId, userId);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		return result;
	}

	@Override
	public int insertMemberSkill(MemberSkill memberSkill) throws Exception{
		int result = 0;
		try {
			result = memberSkillMapper.insertMemberSkill(memberSkill);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		return result;
	}

	@Override
	public void updateMemberSkill(MemberSkill memberSkill) throws Exception{
		try {
			memberSkillMapper.updateMemberSkill(memberSkill);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		
	}

	@Override
	public void deleteMemberSkill(int SkillSeq) throws Exception{
		try {
			memberSkillMapper.deleteMemberSkill(SkillSeq);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		
	}

	@Override
	public void deleteMemberSkillBySkillSeq(int SkillSeq) throws Exception {
		try {
			memberSkillMapper.deleteMemberSkillBySkillSeq(SkillSeq);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		
	}

}
